package com.lkd.controller;

import com.lkd.exception.BusinessException;
import com.lkd.result.Result;
import com.lkd.utils.AliOssUtil;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;
@RestController
@Slf4j
public class FileUploadController {
    @Autowired
    private AliOssUtil aliOssUtil;
    //图片上传
    @PostMapping("/api/vm-service/sku/fileUpload")
    public Result load(MultipartFile fileName)throws Exception{
        String url = aliOssUtil.upload(fileName.getOriginalFilename(), fileName.getInputStream());
        return Result.success(url);
    }
}
